Loader Widgetversion added: 1.2
Description: Handles the task of displaying the loading dialog when jQuery Mobile pulls in content via Ajax.
The Loader Widget
The loader widget handles the task of displaying the loading dialog when jQuery Mobile pulls in content via Ajax. It can also be displayed manually for custom loading actions using the $.mobile.loading
helper method (See the global method docs).
To configure the loading dialog globally the following settings can be defined on its prototype during the mobileinit
event.
1
2
3
4
5
6
|
|
These defaults will only be superseded by the method params object described in the global method docs under $.mobile.loading
.
1
2
3
4
5
6
|
|
Options
defaultsType: Boolean
false
true
indicates that other widgets options have default values and causes jQuery Mobile's widget autoenhancement code to omit the step where it retrieves option values from data attributes. This can improve startup time.
This option is also exposed as a data attribute: data-defaults="true"
.
Initialize the loader with the defaults
option specified:
1
|
|
Get or set the defaults
option, after initialization:
1
2
3
4
5
|
|
disabledType: Boolean
false
true
.
This option is also exposed as a data attribute: data-disabled="true"
.
Initialize the loader with the disabled
option specified:
1
|
|
Get or set the disabled
option, after initialization:
1
2
3
4
5
|
|
htmlType: string
""
Initialize the loader with the html
option specified:
1
|
|
Get or set the html
option, after initialization:
1
2
3
4
5
|
|
textType: string
loading
Initialize the loader with the text
option specified:
1
|
|
Get or set the text
option, after initialization:
1
2
3
4
5
|
|
textVisibleType: boolean
false
Initialize the loader with the textVisible
option specified:
1
|
|
Get or set the textVisible
option, after initialization:
1
2
3
4
5
|
|
textonlyType: boolean
false
Initialize the loader with the textonly
option specified:
1
|
|
Get or set the textonly
option, after initialization:
1
2
3
4
5
|
|
themeType: String
null, inherited from parent
Possible values: swatch letter (a-z).
This option is also exposed as a data attribute: data-theme="b"
.
Initialize the loader with the theme
option specified:
1
|
|
Get or set the theme
option, after initialization:
1
2
3
4
5
|
|
Methods
checkLoaderPosition()Returns: jQuery (plugin only)
- This method does not accept any arguments.
Invoke the checkLoaderPosition method:
1
|
|
fakeFixLoader()Returns: jQuery (plugin only)
- This method does not accept any arguments.
Invoke the fakeFixLoader method:
1
|
|
hide()Returns: jQuery (plugin only)
- This method does not accept any arguments.
Invoke the hide method:
1
|
|
loading()Returns: jQuery (plugin only)
$.mobile.loader
prototype options as described in the widget docs or can be controlled via a params object.
- This method does not accept any arguments.
Invoke the loading method:
1
|
|
resetHtml()Returns: jQuery (plugin only)
- This method does not accept any arguments.
Invoke the resetHtml method:
1
|
|
show()Returns: jQuery (plugin only)
- This method does not accept any arguments.
Invoke the show method:
1
|
|
Events
create( event, ui )Type: loadingcreate
Note: The ui
object is empty but included for consistency with other events.
Initialize the loader with the create callback specified:
1
2
3
|
|
Bind an event listener to the loadingcreate event:
1
|
|
Example:
Loader Examples
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
|